package com.bistu.xiong.factory.bean;

/**
 * Created by XiongXiaoJun on 2017/12/25.
 */

public class ChatMessage {
    public static final int TEXT = 100000;//文本类数据
    public static final int URL = 200000;//网址类数据
    public static final int NEWS = 302000;//新闻
    public static final int APP = 304000;//应用、软件、下载
    public static final int TRAIN = 305000;//列车
    public static final int PLANE = 306000;//航班
    public static final int VIDEO = 308000;//菜谱、视频、小说
    public static final int HOTEL = 309000;//酒店
    public static final int PLACE = 311000;//价格

    public static final int ERRORKEY_LEN = 40001;//key的长度错误（32位）
    public static final int ERROR_TEXT_NULL = 40002;//请求内容为空
    public static final int ERROR_KEY_ERROR = 40003;//key错误或帐号未激活
    public static final int ERROR_OUT_OF_TIMES = 40004;//当天请求次数已用完
    public static final int ERROR_NOT_SUPPORT = 40005;//暂不支持该功能
    public static final int ERROR_SERVER_UPDATE = 40006;//服务器升级中
    public static final int ERROR_DATA_FORMAT = 40007;//服务器数据格式异常

    private boolean isRobot = false;
    private int type;
    private long time;
    private int code;
    private String text;
    private String url;

    public ChatMessage(int type, long time, int code, String text, String url) {
        this.type = type;
        this.time = time;
        this.code = code;
        this.text = text;
        this.url = url;
    }

    public ChatMessage(String text){
        this.text = text;
        this.isRobot = false;
    }

    public ChatMessage(String text, boolean isRobot){
        this.text = text;
        this.isRobot = isRobot;
    }

    public boolean success() {
        return code>=100000;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public boolean isRobot() {
        return isRobot;
    }

    public void setRobot(boolean robot) {
        isRobot = robot;
    }
}
